﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Star.aspx.cs" Inherits="Jy123.Web.Manage.Star" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理球星教练</title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.js" type="text/javascript"></script>

    <script src="js/jquery.ui.js" type="text/javascript"></script>

    <script src="js/main.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
function ChangeType(){
    var select=document.getElementById('<%=typeDropDown.ClientID %>');
    var required=document.getElementById('<%=expRequired.ClientID %>');    
    if(select.options[1].selected){
        $('#expDiv').css('display','block');
        $('#desStarDiv').css('display','block');
        $('#desCocheDiv').css('display','none');        
        required.enabled=true;
    }else if(select.options[2].selected){
       $('#expDiv').css('display','none');
        $('#desStarDiv').css('display','none');
        $('#desCocheDiv').css('display','block');
        required.enabled=false; 
    }    
}

 function SetValidate(control){
     var id=control.id;
     var tId=id.replace("cNameCheckBox","valueTextBox");
     var rId=id.replace("cNameCheckBox","valueRequired");
     var textBox=document.getElementById(tId);
     var required=document.getElementById(rId);
     var isChecked=control.checked;
     if(isChecked){
         textBox.disabled="";
     }else{
         textBox.disabled="disabled";
     }
     required.enabled=isChecked;               
  }  
 
function Validate(){ 
        var fileUploadSmall=document.getElementById('<%=fileUploadSmall.ClientID %>');
        var fileUploadBig=document.getElementById('<%=fileUploadBig.ClientID %>');
        var actionHidden=document.getElementById('<%=actionTypeHidden.ClientID %>');
        var button=document.getElementById('<%=SaveButton.ClientID %>');
        button.disabled=""; 
        var fileName;
        var index;
        var length;
        var fileType;       
        if(fileUploadSmall.value==''){        
            if(actionHidden.value=='Add'){
                $("#noSmallLogoSpan").css('display','block');
                $("#errorSmallLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noSmallLogoSpan").css('display','none');
            fileName=fileUploadSmall.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorSmallLogoSpan").css('display','none');
                $("#iconImg").attr("src",fileUploadSmall.value);       
           }else{
                $("#errorSmallLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
        
        if(fileUploadBig.value==''){        
            if(actionHidden.value=='Add'){
                $("#noBigLogoSpan").css('display','block');
                $("#errorBigLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noBigLogoSpan").css('display','none');
            fileName=fileUploadBig.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorBigLogoSpan").css('display','none');
                $("#JTypeImage").attr("src",fileUploadBig.value)            
           }else{
                $("#errorBigLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
      }
    
    </script>

</head>
<body>
    <h4>
        <a href="#"><span>球星教练管理</span></a></h4>
    <form id="manageJTypeForm" runat="server">
    <div class="register">
        <ul>
            <li class="w85r b">运动类型 </li>
            <li>
                <asp:DropDownList ID="sportTypeDropDown" runat="server" OnSelectedIndexChanged="sportTypeDropDown_Change"
                    AutoPostBack="true">
                </asp:DropDownList>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="JTypeNameRequired" CssClass="warning" runat="server"
                    ControlToValidate="sportTypeDropDown" ErrorMessage="请选择运动类型" Display="Dynamic"
                    ForeColor="" InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">类型 </li>
            <li>
                <asp:DropDownList ID="typeDropDown" runat="server" onchange="ChangeType()">
                </asp:DropDownList>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="warning" runat="server"
                    ControlToValidate="typeDropDown" ErrorMessage="请选择类型" Display="Dynamic" ForeColor=""
                    InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">名字 </li>
            <li>
                <asp:TextBox CssClass="text" ID="nameTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" CssClass="warning" runat="server"
                    ControlToValidate="nameTextBox" ErrorMessage="请填写名字" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">技术 </li>
            <li>
                <asp:TextBox CssClass="text" ID="skillTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" CssClass="warning" runat="server"
                    ControlToValidate="skillTextBox" ErrorMessage="请填写技术值" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="moneyRange" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="255" ControlToValidate="skillTextBox" ErrorMessage="请填写1-255之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">体力 </li>
            <li>
                <asp:TextBox CssClass="text" ID="fitnessTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" CssClass="warning" runat="server"
                    ControlToValidate="fitnessTextBox" ErrorMessage="请填写体力值" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator1" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="255" ControlToValidate="fitnessTextBox" ErrorMessage="请填写1-255之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">活力 </li>
            <li>
                <asp:TextBox CssClass="text" ID="livenessTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" CssClass="warning" runat="server"
                    ControlToValidate="livenessTextBox" ErrorMessage="请填写活力值" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator2" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="255" ControlToValidate="livenessTextBox" ErrorMessage="请填写1-255之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">士气 </li>
            <li>
                <asp:TextBox CssClass="text" ID="moralTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" CssClass="warning" runat="server"
                    ControlToValidate="moralTextBox" ErrorMessage="请填写士气值" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator3" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="255" ControlToValidate="moralTextBox" ErrorMessage="请填写1-255之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="expDiv" style="display: none">
            <li class="w85r b">经验 </li>
            <li>
                <asp:TextBox CssClass="text" ID="expTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="expRequired" CssClass="warning" runat="server" Enabled="false"
                    ControlToValidate="expTextBox" ErrorMessage="请填写经验值" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator4" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="99999999" ControlToValidate="expTextBox" ErrorMessage="请填写1-99999999之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">价格 </li>
            <li>
                <asp:TextBox CssClass="text" ID="moneyTextBox" runat="server"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" CssClass="warning" runat="server"
                    ControlToValidate="moneyTextBox" ErrorMessage="请填写价格" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator5" CssClass="warning" runat="server" Type="Integer"
                    MinimumValue="1" MaximumValue="99999999" ControlToValidate="moneyTextBox" ErrorMessage="请填写1-99999999之间的整数"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="ulDiv" runat="server" visible="false">
            <li class="w85r b">使用等级 </li>
            <li>
                <asp:CheckBoxList ID="ulCheckBoxList" runat="server" RepeatDirection="Horizontal"
                    RepeatColumns="10">
                </asp:CheckBoxList>
            </li>
        </ul>
        <h5>
            大图标
        </h5>
        <ul>
            <li>
                <asp:FileUpload ID="fileUploadBig" CssClass="text" runat="server" onchange="Validate()" />
            </li>
            <li>
                <img id="JTypeImage" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noBigLogoSpan" class="warning" style="display: none">请上传一张图片</span> <span
                id="errorBigLogoSpan" class="warning" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <h5>
            小图标
        </h5>
        <ul>
            <li>
                <asp:FileUpload ID="fileUploadSmall" CssClass="text" runat="server" onchange="Validate()" />
            </li>
            <li>
                <img id="iconImg" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noSmallLogoSpan" class="warning" style="display: none">请上传一张图片</span> <span
                id="errorSmallLogoSpan" class="warning" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul id="desStarDiv" style="display: none">
            <li class="w85r b">明星具体描述 </li>
            <li>
                <asp:Repeater ID="StarOptionRepeater" runat="server" Visible="false" OnItemDataBound="StarOptionRepeater_DataBound">
                    <HeaderTemplate>
                        <table class="tblist">
                            <tr>
                                <th>
                                    描述项目
                                </th>
                                <th>
                                    具体描述
                                </th>
                            </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td>
                                <asp:HiddenField ID="idHiddenCondition" runat="server" />
                                <asp:CheckBox ID="cNameCheckBox" runat="server" onclick="SetValidate(this)" />
                            </td>
                            <td>
                                <asp:TextBox ID="valueTextBox" runat="server" Enabled="false" Columns="70" Rows="5"
                                    TextMode="MultiLine"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="valueRequired" CssClass="warning" runat="server"
                                    Enabled="false" ControlToValidate="valueTextBox" ErrorMessage="请填写具体描述" Display="Dynamic"
                                    ForeColor=""></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </li>
        </ul>
        <ul id="desCocheDiv" style="display: none">
            <li class="w85r b">教练具体描述 </li>
            <li>
                <asp:TextBox ID="cocheTextBox" runat="server" Columns="70" Rows="5" TextMode="MultiLine"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="valueRequired" CssClass="warning" runat="server"
                    Enabled="false" ControlToValidate="cocheTextBox" ErrorMessage="请填写具体描述" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">
                <asp:HiddenField ID="actionTypeHidden" runat="server" Value="Add" />
            </li>
            <li>
                <asp:HiddenField ID="idHiddenEdit" runat="server" />
            </li>
            <li>
                <asp:Button ID="SaveButton" runat="server" CssClass="button" Text="保存" OnClick="Save" />
            </li>
        </ul>
    </div>
    <asp:Repeater ID="StarRepeater" runat="server" Visible="false" OnItemDataBound="Repeater_DataBound"
        OnItemCommand="Repeater_Command">
        <HeaderTemplate>
            <table class="tblist">
                <tr>
                    <th>
                        运动类型
                    </th>
                    <th>
                        类型
                    </th>
                    <th>
                        名字
                    </th>
                    <th>
                        技术
                    </th>
                    <th>
                        体力
                    </th>
                    <th>
                        活力
                    </th>
                    <th>
                        士气
                    </th>
                    <th>
                        经验
                    </th>
                    <th>
                        价格
                    </th>
                    <th>
                        使用等级
                    </th>                    
                    <th>
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:HiddenField ID="idHidden" runat="server" />
                    <asp:Label ID="sportTypeLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="typeLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="nameLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="skillLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="fitnessLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="livenessLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="moralLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="expLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="priceLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="usingLevelLabel" runat="server"></asp:Label>
                </td>                
                <td>
                    <asp:LinkButton ID="EditButton" runat="server" CssClass="btnsty" CausesValidation="false"
                        CommandName="Edit" Text="修改" />
                    <asp:LinkButton ID="DeleteButton" runat="server" CssClass="btnsty cred" CausesValidation="false"
                        CommandName="Delete" Text="删除" OnClientClick="return confirm('确定删除？')" />
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    </form>
</body>
</html>
